Skip to content

fix: The project root is ambiguous in tsconfig.json#2127

Merged
dprevost-LMI merged 8 commits into
webdriverio:mainfrom
dprevost-LMI:fix-tsconfig-ambigious-root
Jun 29, 2026
Merged

fix: The project root is ambiguous in tsconfig.json#2127
dprevost-LMI merged 8 commits into
webdriverio:mainfrom
dprevost-LMI:fix-tsconfig-ambigious-root

Conversation

@dprevost-LMI

Copy link
Copy Markdown
Contributor

Fixing the below error that sometimes also fails when executing npm checks:all

  • Also, fix missing tsc on __mock__ folder.
The project root is ambiguous, but is required to resolve export map entry '.' in file '/Users/dprevost/Git/expect-webdriverio/package.json'. Supply the `rootDir` compiler option to disambiguate.ts

@dprevost-LMI dprevost-LMI marked this pull request as ready for review June 28, 2026 16:06
@greptile-apps

greptile-apps Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR resolves the The project root is ambiguous TypeScript error by restructuring the two tsconfig files: moving outDir exclusively into tsconfig.build.json (together with an explicit rootDir: \"./src\" that disambiguates the export-map lookup), and removing it from the base tsconfig.json, which now only serves type-checking with --noEmit. Coverage thresholds have been raised alongside these changes.

  • tsconfig.build.json — switched from an exclude-based approach to an explicit include: [\"./src/**/*.ts\"], and added rootDir, outDir, tsBuildInfoFile, and module/moduleResolution: \"nodenext\" (the root cause fix).
  • tsconfig.json — removed outDir (no longer needed for a pure type-check config), added __mocks__/**/*.ts to the include list so mock files are covered by tsc, and kept moduleResolution: \"bundler\" for test code.
  • vitest.config.ts — coverage thresholds raised slightly across all four metrics.

Confidence Score: 5/5

Safe to merge — changes are scoped entirely to TypeScript configuration and test tooling with no runtime impact.

The root fix (adding rootDir to tsconfig.build.json and moving outDir out of the base config) is correct and targeted. Switching the build to module/moduleResolution nodenext is intentional and appropriate for the ESM package. No logic, runtime, or API surface is changed.

No files require special attention.

Important Files Changed

Filename Overview
tsconfig.build.json Core fix: adds explicit rootDir, outDir, module/moduleResolution (nodenext), and tsBuildInfoFile; switches to include-based filtering — cleanly resolves the project root is ambiguous error.
tsconfig.json Removes outDir (now only in tsconfig.build.json), adds mocks/**/*.ts to includes; minor style inconsistency (missing leading ./ on the mocks glob) but functionally correct.
vitest.config.ts Coverage thresholds raised across all four metrics — straightforward update reflecting improved test coverage.
playgrounds/package-lock.json Lock file updated to reflect a version bump from 5.6.8 to 5.7.0 for the parent package — no concerns.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[npm run build] --> B[compile:lib - tsc --build tsconfig.build.json]
    A --> C[test:tsc - tsc --project tsconfig.json --noEmit]
    B --> D[tsconfig.build.json]
    D --> E[rootDir: ./src, outDir: ./lib/, module: nodenext]
    E --> G[lib/ output]
    C --> H[tsconfig.json - moduleResolution: bundler, no outDir]
    H --> I[src + mocks + test included]
    I --> J[type-check only, no emit]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[npm run build] --> B[compile:lib - tsc --build tsconfig.build.json]
    A --> C[test:tsc - tsc --project tsconfig.json --noEmit]
    B --> D[tsconfig.build.json]
    D --> E[rootDir: ./src, outDir: ./lib/, module: nodenext]
    E --> G[lib/ output]
    C --> H[tsconfig.json - moduleResolution: bundler, no outDir]
    H --> I[src + mocks + test included]
    I --> J[type-check only, no emit]
Loading

Reviews (4): Last reviewed commit: "Rerun playgrounds + increase coverage" | Re-trigger Greptile

Comment thread types-checks-filter-out-node_modules.js Outdated
dprevost-LMI and others added 8 commits June 28, 2026 21:41
The project root is ambiguous, but is required to resolve export map entry '.' in file '/Users/dprevost/Git/expect-webdriverio/package.json'. Supply the `rootDir` compiler option to disambiguate.ts
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@dprevost-LMI dprevost-LMI force-pushed the fix-tsconfig-ambigious-root branch from 710d4d5 to d53cce8 Compare June 29, 2026 01:49
@dprevost-LMI dprevost-LMI merged commit 8c4c31f into webdriverio:main Jun 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant